Q: I'm developing a PowerPC version of my application. In the current version of
my app, I write info into the data fork. What is the recommended way to do this
for the Power PC?
In the documentation it talks about offsetting the data using the cfrg
resource. Would this help? If so, can this be done using Metrowerks
CodeWarrior?
A: Yes. Writing information to the data fork of a PowerPC-native application is
supported. You can actually write the code fragment and update the 'cfrg' using
MergeFragment . MergeFragment takes two files and catenates them. It also
updates the offset and length fields for the code fragment's 'cfrg' resource,
which doesn't necessarily have to start at the beginning of the fork. In fact,
it's easier to read the serial information if you write the code fragment after
the serial information.
A caveat: You need to make sure the offset written to the 'cfrg' is an even
value, and optimally, a multiple of four. MergeFragment should take care of
this, but we recommend checking it in your final build to make sure your 'cfrg'
and data fork are correct. If the offset is not an even value, VM's
file-mapping won't work, and you won't notice a problem unless running your
application on a system with VM enabled.
You can use MergeFragment with Metrowerks' Toolserver interface. Check out the
Metrowerks documentation for more details.
|